package com.springboot.cloud.demos.feign.rest;

import com.springboot.cloud.common.core.entity.vo.Result;
import com.springboot.cloud.demos.feign.service.AnswerService;
import com.springboot.cloud.demos.feign.service.QuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class QuestionController {

    @Autowired
    private QuestionService questionService;
    @Autowired
    private AnswerService answerService;

    @RequestMapping(value = "/open/question", method = RequestMethod.GET)
    public Result query(@RequestParam String unitId) {
        return questionService.query(unitId);
    }

    @RequestMapping(value = "/open/answer", method = RequestMethod.GET)
    public Result queryAnswer(@RequestParam String questionId) {
        return answerService.query(questionId);
    }
}
